# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: omni <omni+alpine@hack.org>
pkgname=onefetch
pkgver=2.12.0
pkgrel=0
pkgdesc="Git repository summary on your terminal"
url="https://github.com/o2sh/onefetch"
arch="all !s390x !riscv64" # limiteed by rust/cargo
license="MIT"
makedepends="cargo libgit2-dev zlib-dev"
source="$pkgname-$pkgver.tar.gz::https://crates.io/api/v1/crates/onefetch/$pkgver/download"

# Reduce binary size
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_LTO="true"
export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"
export CARGO_PROFILE_RELEASE_PANIC="abort"

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -Dm0755 target/release/onefetch "$pkgdir"/usr/bin/onefetch
}

sha512sums="
02f6c8c11d6595b2df822fe875d6ceb5835d827006a60829ac0160a48031a6154f2a621af3ec51619cd0413fd4eecc4b5aabd6d06318093d3ff4f33160b02d4d  onefetch-2.12.0.tar.gz
"
